<?php 
/*ini_set("display_errors",1); 
$url = "http://viphim.com/movie/watch/164980/";
$agent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322)";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec ($ch);
echo $result;
include('SimpleImage.php');
function save_img($url){
	$exp = explode('/',$url);
	$lastIndex = sizeof($exp);
	if($data_s=file_get_contents($url,0))
	{
		$path="img/".$exp[$lastIndex-1];
		file_put_contents($path,$data_s);
	}
	return $path;
}
function renameImageToThumbnail($img){
   $array = explode('.',$img);
   $img = $array[0]."_thumbnail".$array[1];
   return $img;
}
$image = new SimpleImage();
$img=$path;
$load_img='../'.$img;
$image ->load($load_img);
$image ->resize(125,160);
$save_url ='../'.renameImageToThumbnail($img);
$image ->save($save_url);
$exp = explode('/',"http://1.bp.blogspot.com/-aMpVpOgNmeI/UYERSqzTB9I/AAAAAAAAAyk/GRkEf-G8G6Y/s1600/Superman-Unbound_phimzip.com.jpg");
$lastIndex = sizeof($exp);
$rename = explode(".",$exp[$lastIndex-1]);
$lastIndex=sizeof($rename);
for($i=0;$i<=sizeof($rename);$i++)
{
	if($i == $lastIndex-1)
	$newname = $newname."_thumbnail.".$rename[$i];
	else 
	$newname = $newname.$rename[$i];
}
echo $newname;*/
/*function save_img($url){
	$exp = explode('/',$url);
	$lastIndex = sizeof($exp);
	if($data_s=file_get_contents($url,0))
	{
		$path="../upload/".$exp[$lastIndex-1];
		file_put_contents($path,$data_s);
	}
	return $path = "upload/".$exp[$lastIndex-1];
}
$url='http://4.bp.blogspot.com/-M2FJ2Gwu-28/Tkh42xfs4DI/AAAAAAAAHg0/MjxtXL3959k/s400/The+Unborn+Child+%25282011%2529.jpg';
$exp=explode('?',$url);
echo $exp[0];
$src = save_img($exp[0]);*/

?>
<!--<img src="../upload/TheUnbornChild252820112529.jpg" />
<img src="<?php //echo $path;?>" />-->

<!-- test get all server --->
<!--<div id="loader"></div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$.ajaxSetup ({  
        cache: false  
    });
var lienket = 'http://viphim.com/movie/watch/25444/tham-tu-k-bi-mat-goa-phu.html';

var server = [];
$('#loader').load("get_link.php .server_total","link="+lienket,function(){
		var size =$(this).find('tr').size();
		for(i=1;i<=size;i++)
		{
			server[i]=$(this).find('td:nth-child('+i+')').clone().children().remove().end().text();	
			console.log($(this).find('td:nth-child('+i+')').clone().children().remove().end().text());
		}
	})
</script>-->
<?php 
$ch = curl_init ("http://docbao.com.vn/docbao/bao-bdg/Ban_Duong.dec");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$rawdata=curl_exec ($ch);
curl_close ($ch);

$fp = fopen("test.html",'w');
fwrite($fp, $rawdata); 
fclose($fp);
?>



